package com.ssy.lingxi.logistics.api.enums;

import java.util.Arrays;

/**
 * 物流消息队列类型枚举
 * @author wyx
 * @version 2.0.0
 * @date 2022-03-10
 **/
public enum LogisticsMessageQueueTypeEnum {
    /**
     * 新增或修改门店物流地址 - 1
     */
    SYNC_LOGISTICS_ADDRESS(1),

    /**
     * 删除门店物流地址 - 2
     */
    DELETE_LOGISTICS_ADDRESS(2),

    /**
     * 更新门店物流地址状态 - 3
     */
    UPDATE_LOGISTICS_ADDRESS_STATUS(3),

    /**
     * 未知类型
     */
    UNKNOWN(99);

    LogisticsMessageQueueTypeEnum(Integer code) {
        this.code = code;
    }

    private Integer code;

    public Integer getCode() {
        return code;
    }

    public static LogisticsMessageQueueTypeEnum parse(Integer code) {
        return Arrays.stream(LogisticsMessageQueueTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(UNKNOWN);
    }
}
